The HIST_2D function returns the two dimensional density function (histogram) of two variables.
This routine is written in the IDL language. Its source code can be found in the file hist_2d.pro in the lib subdirectory of the IDL distribution.
Result = HIST_2D( V1, V2 [, BIN1=width] [, BIN2 =height] [, MAX1=value] [, MAX2=value] [, MIN1=value] [, MIN2=value] )
Returns a longword array of dimensions (MAX(V1)+1, MAX(V2)+1). Result(i,j) is equal to the number of simultaneous occurrences of V1 = i and V2 = j at the specified element.
The arguments are arrays containing the variables. V1 and V2 may be of any numeric type except complex. If V1 and V2 do not contain the same number of elements, then the extra elements in the longer array are ignored.
Set this keyword equal to the size of each bin in the V1 direction (column width). If this keyword is not specified, the size is set to 1.
Set this keyword equal to the size of each bin in the V2 direction (row height). If this keyword is not specified, the size is set to 1.
Set this keyword equal to the maximum V1 value to consider. If this keyword is not specified, then V1 is searched for its largest value.
Set this keyword equal to the maximum V2 value to consider. If this keyword is not specified, then V2 is searched for its largest value.
Set this keyword to the minimum V1 value to consider. If this keyword is not specified and if the smallest value of V1 is greater than zero, then MIN1=0 is used, otherwise the smallest value of V1 is used.
Set this keyword to the minimum V2 value to consider. If this keyword is not specified and if the smallest value of V2 is greater than zero, then MIN2=0 is used; otherwise, the smallest value of V2 is used.
To return the 2D histogram of two byte images:
R = HIST_2D(image1, image2)
To display the 2D histogram made from two floating point images, restricting the range from -1 to +1, and with 101 bins:
F1 = RANDOMN(seed, 256, 256)
F2 = RANDOMN(seed, 256, 256)
Result = HIST_2D(F1, F2, MIN1=-1, MAX1=1, $
MIN2=-1, MAX2=1, BIN1=0.02, BIN2=0.02)
TVSCL, Result
Pre 4.0 |
Introduced |
H_EQ_CT , H_EQ_INT , HIST_EQUAL , HISTOGRAM